package com.hy.demo.learn.thread;

/**
 * <p>
 *
 * </p>
 *
 * @author cjl
 * @version 1.0
 * @since 2020-07-29 14:41
 */
public class CyleWait implements Runnable {

    private String name;

    @Override
    public void run() {

        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        name ="My Name Is Gua Pi";
    }

    public static void main(String[] args) throws InterruptedException {

        CyleWait cyleWait=new CyleWait();
        Thread thread=new Thread(cyleWait);
        thread.start();
//        while (cyleWait.name==null){
//            Thread.sleep(100);
//        }
        thread.join();
        System.out.println(cyleWait.name);
    }
}
